<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp">
    <!--通过元素名-->
    <!--<runoob-directive></runoob-directive>-->
    <!--通过属性-->
    <div runoob-directive></div>
    <!--通过类名-->
    <!--<div class="runoob-directive"></div>-->

    <!--通过注释-->
    <!-- directive: runoob-directive -->
    <script>
        var app = angular.module("myApp",[]);
        app.directive("runoobDirective",function () {
            return{
                restrict:"A",
                replace:true,
                template:"<h1>自定义指令！</h1>"
            }
        });
    </script>
</div>

</body>
</html>